'use strict';

const BasicController = require("./basic");

class ComponentController extends BasicController {
  async update() {
    const { request, model } = this.ctx;
    let { conponents, commitMsg, version } = request.body;
    await model.Components.deleteMany({})
    await model.Components.insertMany(conponents);
    this.message(`version${version}更新成功`)
  }


  async list() {
    const { model } = this.ctx;

    const components = await model.Components.find();

    this.success(components);
  }
}

module.exports = ComponentController;
